/**
 * There are code generation
 */
package com.neusoft.lohas.modules.ivm.dao.product;

import org.springframework.stereotype.Repository;

import com.neusoft.lohas.common.persistence.BaseDao;
import com.neusoft.lohas.common.persistence.Parameter;
import com.neusoft.lohas.modules.ivm.entity.product.ProductClassify;

/**
 * 商品分类DAO接口
 * @author Jackie.Liu
 * @version 2014-10-28
 */
@Repository
public class ProductClassifyDao extends BaseDao<ProductClassify> {

	public ProductClassify findByName(String name, String mId) {
		return getByHql("from ProductClassify where name = :p1 and merchant.id = :p2 and delFlag = :p3", new Parameter(name, mId, ProductClassify.DEL_FLAG_NORMAL));
	}
	
	//删除子类
	public int deleteChildrens(String id){
		return update("update ProductClassify set delFlag=1 where parent.id = :p1", new Parameter(id));
	}

}
